﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MC.RideEvent.Mvc.Models.Entity;
using MC.RideEvent.Mvc.Models.ViewModel;
using AutoMapper;

namespace MC.RideEvent.Mvc.Models.Repository
{
    public class VehiculeModelRepository : IVehiculeModelRepository
    {
        private RideEventDBEntities _context;

        public VehiculeModelRepository()
        {
            _context = new RideEventDBEntities();
        }

        public List<VehiculeModelModel> ListModelByBrandId(int brandId)
        {
            var list = (from m in _context.VehiculeModels
                        where m.VehiculeBrandId == brandId
                        select m).ToList();
            
            var datas = Mapper.Map<List<VehiculeModel>, List<VehiculeModelModel>>(list);

            return datas;
        }
    }
}
